package hackathon1212;

import java.util.Map;

import javax.persistence.EntityManager;
import javax.persistence.Query;

public class DeleteService extends ServletPojoAdapter {

	private static final long serialVersionUID = 2641337670561826977L;

	protected Integer getBusinessMethod(Map<String, String[]> params){
		final String clazz = params.get("class")[0];
		EntityManager entityManager=EMF.get().createEntityManager();
		try{
			final Query query=entityManager.createQuery("DELETE FROM " + clazz +" o");
			return query.executeUpdate();
		}
		finally{
			entityManager.close();
		}
	}

}
